"""
判断一个给定的正整数是否素数
"""
n = eval(input())
for i in range(0, n):
    m = eval(input())
    if m == 1:
        print('No')
        continue
    flag = -1
    for j in range(2, m):
        if m % j == 0:
            flag = 1
            print('No')
            break
    if flag != 1:
        print('Yes')